const app = getApp()
import {
  wxRequest
} from '../../../utils/server.js';
const _wxRequest = new wxRequest();
Page({

  data: {
    imgUrl: app.globalData.imgUrl,
    mobile: ''
  },

  onShow: function () {
    var userInfo = wx.getStorageSync('userInfo').mobile
    this.setData({
      mobile: userInfo
      // mobile: userInfo.substring(0, 3) + '******' + userInfo.substring(8, 11)
    })
  },

  toAddressList: function () {
    wx.navigateTo({
      url: '/pages/address/list',
    })
  },

  clearCache() {
    _wxRequest.wxTonkenAjax({
      url: app.globalData.apiUrl + '/sys/protected/structure/reloadStructrue',
      method: 'GET'
    }, (res) => {
      console.log(res)
    })
    _wxRequest.wxTonkenAjax({
      url: app.globalData.apiUrl + '/sys/protected/comm/system/clearCache',
      method: 'GET'
    }, (res) => {
      console.log(res)
    })
    _wxRequest.wxTonkenAjax({
      url: app.globalData.apiUrl + '/org/protected/comm/system/clearCache',
      method: 'GET'
    }, (res) => {
      console.log(res)
    })
    _wxRequest.wxTonkenAjax({
      url: app.globalData.apiUrl + '/gds/protected/comm/system/clearCache',
      method: 'GET'
    }, (res) => {
      console.log(res)
    })
    _wxRequest.wxTonkenAjax({
      url: app.globalData.apiUrl + '/odr/protected/comm/system/clearCache',
      method: 'GET'
    }, (res) => {
      console.log(res)
    })
    _wxRequest.wxTonkenAjax({
      url: app.globalData.apiUrl + '/com/protected/comm/system/clearCache',
      method: 'GET'
    }, (res) => {
      console.log(res)
    })
    wx.showToast({
      title: '成功',
    })
  },
  outlogin: function () {
    wx.removeStorageSync('Authorization', '');
    wx.removeStorageSync('userInfo');
    wx.removeStorageSync('authorized');
    wx.removeStorageSync('picLimit');
    //wx.clearStorageSync();
    wx.showToast({
      title: '退出成功',
    })
    setTimeout(function () {
      wx.redirectTo({
        url: '/pages/login/login',
      })
    }, 1500)
  },

  //修改密码
  toPassword: function () {
    wx.redirectTo({
      url: '/pages/menber/setting/password',
    })
  },

  //充值密码
  toResetPwd: function () {
    wx.redirectTo({
      url: '/pages/menber/setting/reset',
    })
  },

  //编辑
  handleEdit: function () {
    wx.navigateTo({
      url: '/pages/menber/my/index',
    })
  },



})